file(GLOB HEADS "*.h" "*.hpp")
file(GLOB SRCS  "*.c" "*.cpp" "*.ui")


set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_package(QT NAMES Qt5 Qt6 REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui OpenGL Widgets)

set(OSG_KEYS
    osg
    osgAnimation
    osgDB
    osgFX
    osgGA
    osgManipulator
    osgParticle
    osgPresentation
    osgShadow
    osgSim
    osgTerrain
    osgText
    osgUI
    osgUtil
    osgViewer
    osgVolume
    osgWidget
)

foreach (LIBRARY ${OSG_KEYS})
    list(APPEND OSG_LIBRARY_FILE_NAMES ${LIBRARY})
endforeach()

set(EXEC ${PROJECT_NAME})
add_executable(${EXEC} ${HEADS} ${SRCS})
target_link_libraries(${EXEC} ${OSG_LIBRARY_FILE_NAMES} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::OpenGL Qt${QT_VERSION_MAJOR}::Widgets)

